<template>
  <el-dialog
  title="工单配置"
  :visible="dialogVisible"
  width="630px"
  @open='openFn'
  @close='closeFn'
  >
<el-form ref="form" :model="form" label-width="140px" :rules="rules">
      <el-form-item label="补货警戒线:" prop="num">
    <el-input-number v-model="form.num" controls-position="right" @change="handleChange" :min="1" :max="90" style="width:396px;margin-right:140px"></el-input-number>
    </el-form-item>
    <el-form-item >
<el-row>
    <el-col :span="12" style="margin-left:50px">
        <el-button @click="closeFn" >取 消</el-button>
    <el-button type="primary" style="margin-left:30px" @click="comfirmFn">确 定</el-button>
    </el-col>
</el-row>
    </el-form-item>
</el-form>

</el-dialog>

</template>

<script>
import { supplyAlertValue } from '@/api/workorder'
export default {
  props: {
    dialogVisible: Boolean
  },
  data () {
    return {
    //   dialogVisible: true
      form: {
        num: 1
      },
      rules: {
        num: [
          { required: true, message: '请输入', trigger: 'change' }
        ]
      }
    }
  },
  methods: {
    handleChange (value) {
      console.log(value)
    },
    async getSupplyAlertValueFn () {
      const res = await supplyAlertValue()
      console.log(res)
      this.form.num = res
    },
    openFn () {
      // console.log(111)
      this.getSupplyAlertValueFn()
      // this.$parent.getWorkList(1)
      console.log(this.$parent)
    },
    closeFn () {
      this.$emit('update:dialogVisible', false)
    },
    async comfirmFn () {
      await this.getSupplyAlertValueFn(this.form.num)
      this.closeFn()
      this.$parent.getWorkList()
      this.$message.success('修改成功')
      console.log(111)
    }
  },
  created () {
    this.getSupplyAlertValueFn()
  }
}
</script>

<style lang="less" scoped>

/deep/.input {
  width: 396px;
  margin-left: 0;
}
/deep/.el-button {
    width: 80px!important;
    height: 36px;
    padding: 0;
    background-color: #fbf4f0!important;
    border: none;
    color: #655b56!important;
}
/deep/.el-button--primary {
background: linear-gradient(135deg,#ff9743,#ff5e20)!important;
color: #fff !important;
}
</style>
